<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-6-19
 * Time: 下午2:49
 */

namespace ActionsHttp;


use Data\Tree_gg_DAO;
use Data\Tree_group_DAO;
use Data\Tree_productor_DAO;
use Data\Tree_species_DAO;

class ProductorList extends BaseActionHttp
{
    public function doAction() {
        parent::doAction();
        $group_id = $this->data[GROUP_ID];
        $province = $this->data[PROVINCE];
        $city = $this->data[CITY];
        $county = $this->data[COUNTY];
        // 浏览页码
        $page_number = $this->data[PAGE_NUM];
        // 每页显示条数
        $every_page_counts = $this->data[EVERY_PAGE_COUNTS];
        // 列表起始值
        $list_start = ($page_number-1)*$every_page_counts;
        if (!$group_id) {
            return $this->SendErrMsg("参数错误，组id为空");
        }

        $productor_list = Tree_productor_DAO::getTxListByGroup_id($group_id,$province,$city,$county,$list_start,$every_page_counts);

        $group_record = Tree_group_DAO::getRecord($group_id);
        $species_id = $group_record->getSPECIES_ID();
        $species_record = Tree_species_DAO::getRecord($species_id);
        $gg_id = $species_record->getGG_ID();
        $gg_record = Tree_gg_DAO::getRecord($gg_id);
        $gg_name = $gg_record->getGG_NAME();
        $gg_dw = $gg_record->getGG_DW();
        $productor_list[GG_NAME] = $gg_name;
        $productor_list[GG_DW] = $gg_dw;


        // 返回数据
        $this->setValue(PRODUCTOR_LIST,$productor_list);
        $this->ResponseDataToCurrentClient();

    }

}